function a1()
  {

    for (i=0 ; i<document.first.quiz.length ; i++)
         {
              if (document.first.quiz[i].checked==true) 
           {
              var t = document.first.quiz[i].value
           }
 }

if (t == "r" )
 { 
  document.getElementById("txt1").value = "1"
  }
else  { 
   document.getElementById("txt1").value = "0"
}
}

function a2()
  {

    for (i=0 ; i<document.second.quiz.length ; i++)
         {
              if (document.second.quiz[i].checked==true) 
           {
              var t = document.second.quiz[i].value
           }
 }

if (t == "r" )
 { 
  document.getElementById("txt2").value = "1"
  }
else  { 
   document.getElementById("txt2").value = "0"
}
}

function a3()
  {

    for (i=0 ; i<document.third.quiz.length ; i++)
         {
              if (document.third.quiz[i].checked==true) 
           {
              var t = document.third.quiz[i].value
           }
 }

if (t == "r" )
 { 
  document.getElementById("txt3").value = "1"
  }
else  { 
   document.getElementById("txt3").value = "0"
}
}

function a4()
  {

    for (i=0 ; i<document.four.quiz.length ; i++)
         {
              if (document.four.quiz[i].checked==true) 
           {
              var t = document.four.quiz[i].value
           }
 }

if (t == "r" )
 { 
  document.getElementById("txt4").value = "1"
  }
else  { 
   document.getElementById("txt4").value = "0"
}
}

function a5()
  {

    for (i=0 ; i<document.five.quiz.length ; i++)
         {
              if (document.five.quiz[i].checked==true) 
           {
              var t = document.five.quiz[i].value
           }
 }

if (t == "r" )
 { 
  document.getElementById("txt5").value = "1"
  }
else  { 
   document.getElementById("txt5").value = "0"
}
}

function a6()
  {

    for (i=0 ; i<document.six.quiz.length ; i++)
         {
              if (document.six.quiz[i].checked==true) 
           {
              var t = document.six.quiz[i].value
           }
       }

if (t == "r" )
 { 
  document.getElementById("txt6").value = "1"
  }
else  { 
   document.getElementById("txt6").value = "0"
}
}

function a7()
  {

    for (i=0 ; i<document.seven.quiz.length ; i++)
         {
              if (document.seven.quiz[i].checked==true) 
           {
              var t = document.seven.quiz[i].value
           }
       }

if (t == "r" )
 { 
  document.getElementById("txt7").value = "1"
  }
else  { 
   document.getElementById("txt7").value = "0"
}
}

function a8()
  {

    for (i=0 ; i<document.eight.quiz.length ; i++)
         {
              if (document.eight.quiz[i].checked==true) 
           {
              var t = document.eight.quiz[i].value
           }
       }

if (t == "r" )
 { 
  document.getElementById("txt8").value = "1"
  }
else  { 
   document.getElementById("txt8").value = "0"
}
}

function a9()
  {

    for (i=0 ; i<document.nine.quiz.length ; i++)
         {
              if (document.nine.quiz[i].checked==true) 
           {
              var t = document.nine.quiz[i].value
           }
       }

if (t == "r" )
 { 
  document.getElementById("txt9").value = "1"
  }
else  { 
   document.getElementById("txt9").value = "0"
}
}

function a10()
  {

    for (i=0 ; i<document.ten.quiz.length ; i++)
         {
              if (document.ten.quiz[i].checked==true) 
           {
              var t = document.ten.quiz[i].value
           }
       }

if (t == "r" )
 { 
  document.getElementById("txt10").value = "1"
  }
else  { 
   document.getElementById("txt10").value = "0"
}
}

function total()
{
var a = parseInt(document.getElementById("txt1").value);
var b = parseInt(document.getElementById("txt2").value);
var c = parseInt(document.getElementById("txt3").value);
var d = parseInt(document.getElementById("txt4").value);
var e = parseInt(document.getElementById("txt5").value);
var f = parseInt(document.getElementById("txt6").value);
var g = parseInt(document.getElementById("txt7").value);
var h = parseInt(document.getElementById("txt8").value);
var i = parseInt(document.getElementById("txt9").value);
var j = parseInt(document.getElementById("txt10").value);
var score = a + b + c + d + e + f + g + h + i + j;
var scoreText = "I scored "+score+" out of 10";
if (isNaN(score)){
alert("Please answer all questions");
return;
}
else
{
document.getElementById("dScore").innerHTML = "You scored "+score+" out of 10";
document.getElementById("getScore").style.display = 'none';
document.getElementById("a1r").style.color = "#00FF00";
document.getElementById("a2r").style.color = "#00FF00";
document.getElementById("a3r").style.color = "#00FF00";
document.getElementById("a4r").style.color = "#00FF00";
document.getElementById("a5r").style.color = "#00FF00";
document.getElementById("a6r").style.color = "#00FF00";
document.getElementById("a7r").style.color = "#00FF00";
document.getElementById("a8r").style.color = "#00FF00";
document.getElementById("a9r").style.color = "#00FF00";
document.getElementById("a10r").style.color = "#00FF00";
document.getElementById("a1w1").style.color = "#d80000";
document.getElementById("a2w1").style.color = "#d80000";
document.getElementById("a3w1").style.color = "#d80000";
document.getElementById("a4w1").style.color = "#d80000";
document.getElementById("a5w1").style.color = "#d80000";
document.getElementById("a6w1").style.color = "#d80000";
document.getElementById("a7w1").style.color = "#d80000";
document.getElementById("a8w1").style.color = "#d80000";
document.getElementById("a9w1").style.color = "#d80000";
document.getElementById("a10w1").style.color = "#d80000";
document.getElementById("a1w2").style.color = "#d80000";
document.getElementById("a2w2").style.color = "#d80000";
document.getElementById("a3w2").style.color = "#d80000";
document.getElementById("a4w2").style.color = "#d80000";
document.getElementById("a5w2").style.color = "#d80000";
document.getElementById("a6w2").style.color = "#d80000";
document.getElementById("a7w2").style.color = "#d80000";
document.getElementById("a8w2").style.color = "#d80000";
document.getElementById("a9w2").style.color = "#d80000";
document.getElementById("a10w2").style.color = "#d80000";
}
if (score == 1){
document.getElementById("tScore1").style.display = 'inline';
}
else if (score == 2){
document.getElementById("tScore2").style.display = 'inline';
}
else if (score == 3){
document.getElementById("tScore3").style.display = 'inline';
}
else if (score == 4){
document.getElementById("tScore4").style.display = 'inline';
}
else if (score == 5){
document.getElementById("tScore5").style.display = 'inline';
}
else if (score == 6){
document.getElementById("tScore6").style.display = 'inline';
}
else if (score == 7){
document.getElementById("tScore7").style.display = 'inline';
}
else if (score == 8){
document.getElementById("tScore8").style.display = 'inline';
}
else if (score == 9){
document.getElementById("tScore9").style.display = 'inline';
}
else if (score == 10){
document.getElementById("tScore10").style.display = 'inline';
}
document.getElementById("HideQuiz").style.display = 'none';
}